import request from '@/utils/request';

export async function pageProjects(params) {
  return request('/project/page', {
    params,
  });
}

export async function saveProject(data) {
  return request('/project', {
    method:"POST",
    data:data
  });
}

export async function updateProject(projectId,data) {
  return request(`/project/${projectId}`, {
    method:"POST",
    data:data
  });
}

export async function getProjectDetail(projectId) {
  return request(`/project/${projectId}`, {
  });
}

export async function getProjectBrief(projectId) {
  return request(`/project/brief/${projectId}`, {
  });
}

export async function listUser(projectId,params) {
  return request(`/project/${projectId}/user/page`, {
    params,
  });
}

export async function saveUser(projectId,data) {
  return request(`/project/${projectId}/user`, {
    method:"POST",
    data:data
  });
}

export async function deleteUser(projectId,userId) {
  return request(`/project/${projectId}/user`, {
    method:"DELETE",
    data:{
      userId:userId
    }
  });
}

export async function getProjectUserPermission(projectId) {
  return request(`/project/${projectId}/user/permission`, {
    method:"GET"
  });
}